<template>
  <div class="home">
    <el-row type="flex" justify="center">
      <el-col>
        <el-carousel indicator-position="outside" height="400px">
          <el-carousel-item v-for="(files,index) in imgs" :key="index">
            <el-image style="width: 100%; height: 100%" :src="files.url" :fit="fit"></el-image>
          </el-carousel-item>
        </el-carousel>
      </el-col>
    </el-row>
    <el-row type="flex" justify="center">
      <el-col>
        <div>
          <el-divider content-position="left">
            <span>新况热点</span>
          </el-divider>
        </div>
      </el-col>
    </el-row>

    <el-tabs tab-position="left">
      <el-tab-pane
        :label="n.title"
        v-for="(n,index) in newsList"
        :key="index"
      >
        <h1>{{n.title}}</h1>
        <div v-html="n.text" style="overflow:auto;height:450px"></div>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script>
import { selectModuleById } from "@/api/module";
export default {
  data() {
    return {
      total: "",
      page: 1,
      size: 10,
      IMG_URL: process.env.IMG_URL,
      imgs: [
        { url: require("../assets/img/动态.jpg") },
        { url: require("../assets/img/故事.jpg") },
      ],
      newsList: [],
    };
  },
  mounted() {
    selectModuleById(2, this.page, this.size).then((res) => {
      this.newsList = res.data.modules;
      this.total = res.data.total;
    });
  },
};
</script>
<style>
.title > h1 {
  margin-top: 0px;
}

img {
  max-width: 100%;
  -position: center bottom;
}

a {
  text-decoration: none;
}
.el-tabs__nav .is-left{ 
   max-width: 130px;
}
</style>